package org.edu.modules.classSchedule.service.impl;

import org.edu.modules.classSchedule.entity.VeJwJsbpksj;
import org.edu.modules.classSchedule.entity.VeJwJsbpksz;
import org.edu.modules.classSchedule.mapper.VeJwJsbpksjMapper;
import org.edu.modules.classSchedule.service.IVeJwJsbpksjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 教师不排课时间
 * @Author:
 * @Date:   2021-05-12
 * @Version: V1.0
 */
@Service
public class VeJwJsbpksjServiceImpl extends ServiceImpl<VeJwJsbpksjMapper, VeJwJsbpksj> implements IVeJwJsbpksjService {
    @Autowired
    private VeJwJsbpksjMapper veJwJsbpksjMapper;

    @Override
    @Transactional
    public boolean setNoScheduleForTeacher(List<VeJwJsbpksj> veJwJsbpksjs,String teacherid) {
        try {
            veJwJsbpksjMapper.deleteAll(teacherid);
            for (VeJwJsbpksj veJwJsbpksj : veJwJsbpksjs) {
                //veJwBpksj.setId(null);
                veJwJsbpksjMapper.insert(veJwJsbpksj);
            }
            return true;
        }
        catch (Exception ex){
            return false;
        }
    }
}
